<div class="grid_4">   
    <div class="da-panel">
        <div class="da-panel-header">
            <span class="da-panel-title">
                <img alt="" src="<?php echo $this->themeUrl; ?>/files/theme/images/icons/color/monitor.png">
                Quản lý đơn hàng
            </span>
        </div>

        <div id="da-ex-tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
            <?php $this->renderPartial('_tabs')?>   

            <div role="grid" class="dataTables_wrapper" id="da-ex-datatable-numberpaging_wrapper">
                <style>
                table.da-table.dataTable tr td{
                    vertical-align: top;
                }
                td.button-column a{
                    display: block;
                    margin-bottom: 10px;
                }
                </style>
                <?php
                    $this->widget('zii.widgets.grid.CGridView', array(
                            'id'=>'bill-grid',
                            'dataProvider'=>$dataProvider,
                            'filter'=>$model,
                            'template' => "{items}\n{summary}\n{pager}",
                            'summaryCssClass' => 'dataTables_info',
                            'pagerCssClass' => 'dataTables_paginate paging_full_numbers',
                            'itemsCssClass' => 'da-table dataTable',
                            'beforeAjaxUpdate'=>'function(id,options){
                                $("#ajax-loading").fadeIn();    
                            }',
                            'afterAjaxUpdate'=>'function(id,options){
                                $("#ajax-loading").fadeOut();    
                            }',
                            'loadingCssClass' => '',
                            'columns'=>array(
                                array(
                                    'header' => 'Mã đơn hàng',
                                    'name' => 'code',
                                    'value' => '$data->code',
                                ),
                               array(
                                    'name' => 'customer_phone',
                                    'type'      =>  'raw',
                                    'value' => '$data->customer->phone ."<br/>".$data->customerNameOnly',
                                ),
                                array(
                                    'header' => 'Loại',
                                    'name' => 'type',
                                    'value' => '$data->typeLabel',
                                    'filter' => $model->typeData,
                                    //'filterHtmlOptions' => array('style' => 'width: 70px'),
                                ),
                                array(
                                    'header' => 'Đồ giặt',
                                    'value' => '$data->listItemHtml',
                                    'type' => 'html',
                                    'filter' => false,
                                ),
                                array(
                                    'header' => 'Tổng tiền',
                                    'value' => '$data->priceLabel',
                                    'type' => 'html',
                                    'filter' => false,
                                    'filterHtmlOptions' => array('style' => 'min-width: 60px'),
                                ),
//                                array(
//                                    'name' => 'customer_name',
//                                    'type'      =>  'raw',
//                                    'value' => '',
//                                    'filterHtmlOptions' => array('style' => 'width: 100px'),
//                                ), 
//                                array(
//                                    'name' => 'branch_id',
//                                    'value' => '$data->branch->name',
//                                    'type' => 'html',
//                                    'filter' => Branch::model()->branchData,
//                                    'filterHtmlOptions' => array('style' => 'width: 120px'),
//                                ),

                                array(
                                    'name' => 'created',
                                    'value' => '$data->created',
                                    'filterHtmlOptions' => array('class' => 'datepicker'),
                                ),
                                array(
                                    'name' => 'status_pay',
                                    'value' => '$data->statusPayLabel."<br/>".
                                                $data->statusDoLabel."<br/>".
                                                $data->statusReturnLabel."<br/>"
                                    ',
                                    'type' => 'html',
                                    'filter' => $model->statusPayData,
                                ),
//                                array(
//                                    'name' => 'status_do',
//                                    'value' => '',
//                                    'type' => 'html',
//                                    'filter' => $model->statusDoData,
//                                ),
//                                array(
//                                    'name' => 'status_return',
//                                    'value' => '$data->statusReturnLabel',
//                                    'type' => 'html',
//                                    'filter' => $model->statusReturnData,
//                                ),
                                array(
                                    'name' => 'status',
                                    'value' => '$data->statusLabel',
                                    'type' => 'html',
                                    'filter' => $model->statusData,
                                ),
//                                array(
//                                    'name' => 'manager_id',
//                                    'value' => '$data->manager->name',
//                                    'type' => 'html',
//                                    'filter' => $managerData,
//                                ),
                                array(
                                    'class'=>'CButtonColumn',
                                    'template'=>'{view} {update}',
                                    'buttons' => array(
                                        'view' => array(
                                            'url'=>'$data->url',
                                            'label'=>'Xem đơn hàng',
                                            'imageUrl'=>$this->themeUrl.'/files/theme/images/icons/color/magnifier.png',
                                        ),
                                        'update' => array(
                                            'url'=>'$data->getAdminUrl("update")',
                                            'label'=>'Cập nhật đơn hàng', 
                                            'imageUrl'=>$this->themeUrl.'/files/theme/images/icons/color/pencil.png',
                                        ),
                                    ),
                                ),
                            ),
                        )); ?>             
            </div>

        </div>

    </div>
</div>       

<script>
    $(function(){
            $(".datepicker input").live('click focus', function(){
                $(this).datepicker({ dateFormat: 'yy-mm-dd' });
            });
    });   
</script>